package pers.course.week1;

import java.util.Scanner;

public class Repeat3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int times = in. nextInt();
        for (int i = 0; i < times; i++) {
            int a = in.nextInt();
            String str = in.nextLine();
            for (int j = 0; j < a; j++) {
                System.out.print(str.substring(1,str.length()));
            }
            System.out.println();
        }
    }
}
